/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.systemcar.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author danilo
 */

@Entity
@Table(name = "combustivel")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Combustivel.findAll", query = "SELECT c FROM Combustivel c"),
    @NamedQuery(name = "Combustivel.findByCmbId", query = "SELECT c FROM Combustivel c WHERE c.cmbId = :cmbId"),
    @NamedQuery(name = "Combustivel.findByCmbDescricao", query = "SELECT c FROM Combustivel c WHERE c.cmbDescricao = :cmbDescricao"),
    @NamedQuery(name = "Combustivel.findByCmbValoratual", query = "SELECT c FROM Combustivel c WHERE c.cmbValoratual = :cmbValoratual"),
    @NamedQuery(name = "Combustivel.findByCmbAtivo", query = "SELECT c FROM Combustivel c WHERE c.cmbAtivo = :cmbAtivo"),
    @NamedQuery(name = "Combustivel.findByCmbDatacadastro", query = "SELECT c FROM Combustivel c WHERE c.cmbDatacadastro = :cmbDatacadastro"),
    @NamedQuery(name = "Combustivel.findByUsrId", query = "SELECT c FROM Combustivel c WHERE c.usrId = :usrId")})
public class Combustivel implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "cmb_id")
    private Integer cmbId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 150)
    @Column(name = "cmb_descricao")
    private String cmbDescricao;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Column(name = "cmb_valoratual")
    private BigDecimal cmbValoratual;
    @Lob
    @Size(max = 65535)
    @Column(name = "cmb_observacao")
    private String cmbObservacao;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2)
    @Column(name = "cmb_ativo")
    private String cmbAtivo;
    @Basic(optional = false)
    @NotNull
    @Column(name = "cmb_datacadastro")
    @Temporal(TemporalType.TIMESTAMP)
    private Date cmbDatacadastro;
    @Basic(optional = false)
    @NotNull
    @Column(name = "usr_id")
    private int usrId;
//    private static final long serialVersionUID = 1L;
//    @Id
//    @GeneratedValue(strategy = GenerationType.IDENTITY)
//    @Basic(optional = false)
//    @NotNull
//    @Column(name = "cmb_id", nullable = false)
//    private Integer cmbId;
//    @Basic(optional = false)
//    @NotNull
//    @Size(min = 1, max = 150)
//    @Column(name = "cmb_descricao", nullable = false, length = 150)
//    private String cmbDescricao;
//    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
//    @Basic(optional = false)
//    @NotNull
//    @Column(name = "cmb_valoratual", nullable = false, precision = 10, scale = 3)
//    private BigDecimal cmbValoratual;
//    @Lob
//    @Size(max = 65535)
//    @Column(name = "cmb_observacao", length = 65535)
//    private String cmbObservacao;
//    @Basic(optional = false)
//    @NotNull
//    @Size(min = 1, max = 2)
//    @Column(name = "cmb_ativo", nullable = false, length = 2)
//    private String cmbAtivo;
//    @Basic(optional = false)
//    @NotNull
//    @Column(name = "cmb_datacadastro", nullable = false)
//    @Temporal(TemporalType.TIMESTAMP)
//    private Date cmbDatacadastro;
//    @Basic(optional = false)
//    @NotNull
//    private static final long serialVersionUID = 1L;
//    @Id
//    @GeneratedValue(strategy = GenerationType.IDENTITY)
//    @Basic(optional = false)
//    @NotNull
//    @Column(name = "cmb_id", nullable = false)
//    private Integer cmbId;
//    @Basic(optional = false)
//    @NotNull
//    @Size(min = 1, max = 150)
//    @Column(name = "cmb_descricao", nullable = false, length = 150)
//    private String cmbDescricao;
//    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
//    @Basic(optional = false)
//    @NotNull
//    @Column(name = "cmb_valoratual", nullable = false, precision = 10, scale = 3)
//    private BigDecimal cmbValoratual;
//    @Lob
//    @Size(max = 65535)
//    @Column(name = "cmb_observacao", length = 65535)
//    private String cmbObservacao;
//    @Basic(optional = false)
//    @NotNull
//    @Size(min = 1, max = 2)
//    @Column(name = "cmb_ativo", nullable = false, length = 2)
//    private String cmbAtivo;
//    @Basic(optional = false)
//    @NotNull
//    @Column(name = "cmb_datacadastro", nullable = false)
//    @Temporal(TemporalType.TIMESTAMP)
//    private Date cmbDatacadastro;
//    @Basic(optional = false)
//    @NotNull
//    private static final long serialVersionUID = 1L;
//    @Id
//    @GeneratedValue(strategy = GenerationType.IDENTITY)
//    @Basic(optional = false)
//    @NotNull
//    @Column(name = "cmb_id", nullable = false)
//    private Integer cmbId;
//    @Basic(optional = false)
//    @NotNull
//    @Size(min = 1, max = 150)
//    @Column(name = "cmb_descricao", nullable = false, length = 150)
//    private String cmbDescricao;
//    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
//    @Basic(optional = false)
//    @NotNull
//    @Column(name = "cmb_valoratual", nullable = false, precision = 10, scale = 3)
//    private BigDecimal cmbValoratual;
//    @Lob
//    @Size(max = 65535)
//    @Column(name = "cmb_observacao", length = 65535)
//    private String cmbObservacao;
//    @Basic(optional = false)
//    @NotNull
//    @Size(min = 1, max = 2)
//    @Column(name = "cmb_ativo", nullable = false, length = 2)
//    private String cmbAtivo;
//    @Basic(optional = false)
//    @NotNull
//    @Column(name = "cmb_datacadastro", nullable = false)
//    @Temporal(TemporalType.TIMESTAMP)
//    private Date cmbDatacadastro;
//    @Basic(optional = false)
//    @NotNull
//    private static final long serialVersionUID = 1L;
//    @Id
//    @GeneratedValue(strategy = GenerationType.IDENTITY)
//    @Basic(optional = false)
//    @NotNull
//    @Column(name = "cmb_id", nullable = false)
//    private Integer cmbId;
//    @Basic(optional = false)
//    @NotNull
//    @Size(min = 1, max = 150)
//    @Column(name = "cmb_descricao", nullable = false, length = 150)
//    private String cmbDescricao;
//    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
//    @Basic(optional = false)
//    @NotNull
//    @Column(name = "cmb_valoratual", nullable = false, precision = 10, scale = 3)
//    private BigDecimal cmbValoratual;
//    @Lob
//    @Size(max = 65535)
//    @Column(name = "cmb_observacao", length = 65535)
//    private String cmbObservacao;
//    @Basic(optional = false)
//    @NotNull
//    @Size(min = 1, max = 2)
//    @Column(name = "cmb_ativo", nullable = false, length = 2)
//    private String cmbAtivo;
//    @Basic(optional = false)
//    @NotNull
//    @Column(name = "cmb_datacadastro", nullable = false)
//    @Temporal(TemporalType.TIMESTAMP)
//    private Date cmbDatacadastro;
//    @Basic(optional = false)
//    @NotNull
//?
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "combustivel")
    private List<PostoCombustivel> postoCombustivelList;

    public Combustivel() {
    }

    public Combustivel(Integer cmbId) {
        this.cmbId = cmbId;
    }

    public Combustivel(Integer cmbId, String cmbDescricao, BigDecimal cmbValoratual, String cmbAtivo, Date cmbDatacadastro, int usrId) {
        this.cmbId = cmbId;
        this.cmbDescricao = cmbDescricao;
        this.cmbValoratual = cmbValoratual;
        this.cmbAtivo = cmbAtivo;
        this.cmbDatacadastro = cmbDatacadastro;
        this.usrId = usrId;
    }

    public Integer getCmbId() {
        return cmbId;
    }

    public void setCmbId(Integer cmbId) {
        this.cmbId = cmbId;
    }

    public String getCmbDescricao() {
        return cmbDescricao;
    }

    public void setCmbDescricao(String cmbDescricao) {
        this.cmbDescricao = cmbDescricao;
    }

    public BigDecimal getCmbValoratual() {
        return cmbValoratual;
    }

    public void setCmbValoratual(BigDecimal cmbValoratual) {
        this.cmbValoratual = cmbValoratual;
    }

    public String getCmbObservacao() {
        return cmbObservacao;
    }

    public void setCmbObservacao(String cmbObservacao) {
        this.cmbObservacao = cmbObservacao;
    }

    public String getCmbAtivo() {
        return cmbAtivo;
    }

    public void setCmbAtivo(String cmbAtivo) {
        this.cmbAtivo = cmbAtivo;
    }

    public Date getCmbDatacadastro() {
        return cmbDatacadastro;
    }

    public void setCmbDatacadastro(Date cmbDatacadastro) {
        this.cmbDatacadastro = cmbDatacadastro;
    }

    public int getUsrId() {
        return usrId;
    }

    public void setUsrId(int usrId) {
        this.usrId = usrId;
    }

    @XmlTransient
    public List<PostoCombustivel> getPostoCombustivelList() {
        return postoCombustivelList;
    }

    public void setPostoCombustivelList(List<PostoCombustivel> postoCombustivelList) {
        this.postoCombustivelList = postoCombustivelList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cmbId != null ? cmbId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Combustivel)) {
            return false;
        }
        Combustivel other = (Combustivel) object;
        if ((this.cmbId == null && other.cmbId != null) || (this.cmbId != null && !this.cmbId.equals(other.cmbId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.systemcar.model.Combustivel[ cmbId=" + cmbId + " ]";
    }

   
    
}
